home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / lib / calc / README < prev    next >
Text File  |  1995-07-17  |  6KB  |  276 lines

  1.  
  2. # Copyright (c) 1993 David I. Bell and Landon Curt Noll
  3. # Permission is granted to use, distribute, or modify this source,
  4. # provided that this copyright notice remains intact.
  5.  
  6. The following calc library files are provided because they serve as 
  7. examples of how use the calc language, and because the authors thought 
  8. them to be useful!
  9.  
  10. If you write something that you think is useful, please send it to:
  11.  
  12.     dbell@canb.auug.org.au
  13.     chongo@toad.com                 {uunet,pyramid,sun}!hoptoad!chongo
  14.  
  15. By convention, a lib file only defines and/or initializes functions,
  16. objects and variables.  (The regression test is an exception.)  Also by
  17. convention, the a usage message regarding each important object and
  18. function is printed at the time of the read.
  19.  
  20. By convention, the global variable  lib_debug  is used to control
  21. the verbosity of debug information printed by lib files.  By default,
  22. the lib_debug has a value of 0.  If lib_debug < 0, then no debug
  23. messages are printed.  If lib_debug >= 0, then only usage message 
  24. regarding each important object are printed at the time of the read.
  25. If lib_debug == 0, then only such usage messages are printed; no
  26. other debug information is printed.
  27.  
  28. To conform to the above convention, your lib files should end with
  29. lines of the form:
  30.  
  31.     global lib_debug;
  32.     if (lib_debug >= 0) {
  33.         print "funcA(side_a, side_b, side_c) defined";
  34.         print "funcB(size, mass) defined";
  35.     }
  36.  
  37.  
  38. =-=
  39.  
  40.  
  41. bernoulli.cal
  42.  
  43.     B(n)
  44.  
  45.     Calculate the nth Bernoulli number.
  46.  
  47.  
  48. bigprime.cal
  49.  
  50.     bigprime(a, m, p) 
  51.  
  52.     A prime test, base a, on p*2^x+1 for even x>m.
  53.  
  54.  
  55. chrem.cal
  56.  
  57.     chrem(r1,m1 [,r2,m2, ...])
  58.     chrem(rlist, mlist)
  59.  
  60.     Chinese remainder theorem/problem solver.
  61.  
  62.  
  63. cryrand.cal
  64.  
  65.     shufrand()
  66.     sshufrand(seed)
  67.     rand([a, [b]])
  68.     srand(seed)
  69.     cryrand([a, [b]])
  70.     scryrand([seed, [len1, len2]])
  71.     random([a, [b]])
  72.     srandom(seed)
  73.     obj cryobj
  74.     randstate([cryobj | 0])
  75.     nxtprime(n, [val, modulus])
  76.  
  77.     Cryptographically strong pseudo-random number generator library.
  78.     
  79.  
  80. deg.cal        
  81.  
  82.     dms(deg, min, sec)
  83.     dms_add(a, b)
  84.     dms_neg(a)
  85.     dms_sub(a, b)
  86.     dms_mul(a, b)
  87.     dms_print(a)
  88.  
  89.     Calculate in degrees, minutes, and seconds.
  90.  
  91.  
  92. ellip.cal    
  93.  
  94.     factor(iN, ia, B, force)
  95.  
  96.     Attempt to factor using the elliptic functions: y^2 = x^3 + a*x + b.
  97.  
  98.  
  99. lucas.cal
  100.  
  101.     lucas(h, n)
  102.  
  103.     Perform a primality test of h*2^n-1, with 1<=h<2*n.
  104.  
  105.  
  106. lucas_chk.cal
  107.  
  108.     lucas_chk(high_n)
  109.  
  110.     Test all primes of the form h*2^n-1, with 1<=h<200 and n <= high_n.
  111.     Requires lucas.cal to be loaded.  The highest useful high_n is 1000.
  112.  
  113.  
  114. lucas_tbl.cal
  115.  
  116.     Lucasian criteria for primality tables.
  117.  
  118.  
  119. mersenne.cal
  120.  
  121.     mersenne(p)
  122.  
  123.     Perform a primality test of 2^p-1, for prime p>1.
  124.  
  125.  
  126. mod.cal    
  127.  
  128.     mod(a)
  129.     mod_print(a)
  130.     mod_one()
  131.     mod_cmp(a, b)
  132.     mod_rel(a, b)
  133.     mod_add(a, b)
  134.     mod_sub(a, b)
  135.     mod_neg(a)
  136.     mod_mul(a, b)
  137.     mod_square(a)
  138.     mod_inc(a)
  139.     mod_dec(a)
  140.     mod_inv(a)
  141.     mod_div(a, b)
  142.     mod_pow(a, b)
  143.  
  144.     Routines to handle numbers modulo a specified number.
  145.  
  146.  
  147. nextprim.cal
  148.  
  149.     nextprime(n, tries)
  150.  
  151.     Function to find the next prime (probably).
  152.  
  153.  
  154. pell.cal
  155.  
  156.     pellx(D)
  157.     pell(D)
  158.  
  159.     Solve Pell's equation; Returns the solution X to: X^2 - D * Y^2 = 1.
  160.     Type the solution to pells equation for a particular D.
  161.  
  162.  
  163. pi.cal
  164.  
  165.     qpi(epsilon)
  166.  
  167.     Calculate pi within the specified epsilon using the quartic convergence
  168.     iteration.
  169.  
  170.  
  171. pollard.cal
  172.  
  173.     factor(N, N, ai, af)
  174.  
  175.     Factor using Pollard's p-1 method.
  176.  
  177.  
  178. poly.cal    
  179.  
  180.     Calculate with polynomials of one variable.  There are many functions.
  181.     Read the documentation in the library file.
  182.  
  183.  
  184. psqrt.cal    
  185.  
  186.     psqrt(u, p)
  187.  
  188.     Calculate square roots modulo a prime
  189.  
  190.  
  191. quat.cal
  192.  
  193.     quat(a, b, c, d)
  194.     quat_print(a)
  195.     quat_norm(a)
  196.     quat_abs(a, e)
  197.     quat_conj(a)
  198.     quat_add(a, b)
  199.     quat_sub(a, b)
  200.     quat_inc(a)
  201.     quat_dec(a)
  202.     quat_neg(a)
  203.     quat_mul(a, b)
  204.     quat_div(a, b)
  205.     quat_inv(a)
  206.     quat_scale(a, b)
  207.     quat_shift(a, b)
  208.  
  209.     Calculate using quaternions of the form: a + bi + cj + dk.  In these
  210.     functions, quaternians are manipulated in the form: s + v, where
  211.     s is a scalar and v is a vector of size 3.
  212.  
  213.  
  214. regress.cal    
  215.  
  216.     Test the correct execution of the calculator by reading this library file.
  217.     Errors are reported with '****' mssages, or worse.  :-)
  218.  
  219.  
  220. solve.cal    
  221.  
  222.     solve(low, high, epsilon)
  223.  
  224.     Solve the equation f(x) = 0 to within the desired error value for x.
  225.     The function 'f' must be defined outside of this routine, and the low
  226.     and high values are guesses which must produce values with opposite signs.
  227.  
  228.  
  229. sumsq.cal    
  230.  
  231.     ss(p)
  232.  
  233.     Determine the unique two positive integers whose squares sum to the
  234.     specified prime.  This is always possible for all primes of the form
  235.     4N+1, and always impossible for primes of the form 4N-1.
  236.  
  237.  
  238. surd.cal    
  239.  
  240.     surd(a, b)
  241.     surd_print(a)
  242.     surd_conj(a)
  243.     surd_norm(a)
  244.     surd_value(a, xepsilon)
  245.     surd_add(a, b)
  246.     surd_sub(a, b)
  247.     surd_inc(a)
  248.     surd_dec(a)
  249.     surd_neg(a)
  250.     surd_mul(a, b)
  251.     surd_square(a)
  252.     surd_scale(a, b)
  253.     surd_shift(a, b)
  254.     surd_div(a, b)
  255.     surd_inv(a)
  256.     surd_sgn(a)
  257.     surd_cmp(a, b)
  258.     surd_rel(a, b)
  259.  
  260.     Calculate using quadratic surds of the form: a + b * sqrt(D).
  261.  
  262.  
  263. unitfrac.cal
  264.  
  265.     unitfrac(x)
  266.  
  267.     Represent a fraction as sum of distinct unit fractions.
  268.  
  269.  
  270. varargs.cal
  271.  
  272.     sc(a, b, ...)
  273.  
  274.     Example program to use 'varargs'.  Program to sum the cubes of all 
  275.     the specified numbers.
  276.